home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
lib
/
mntlib44.zoo
/
mntlib
/
enoent.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-01
|
903b
|
47 lines
#include <errno.h>
#include <string.h>
#include <stat.h>
#include <mintbind.h>
#include "lib.h"
extern int __mint;
/*
Given a pathname for which some system call returned EPATH, this function
decides if UNIX would have returned ENOENT instead.
Warning: path must be in dos format.
*/
int
_enoent(path)
char *path;
{
register char *s;
struct stat st;
long oldmask;
if (__mint < 9)
{
return 0; /* don't bother... */
}
for (s = path; *s; s++)
/* nop */;
oldmask = Psigblock(~0L);
for ( ; s != path; s--)
{
if (*s == '\\')
{
*s = '\0';
if ((Fxattr(0, path, &st) == 0) && ((st.st_mode & S_IFMT) != S_IFDIR))
{
*s = '\\';
(void) Psigsetmask(oldmask);
return 0; /* existing non-directory file in path, ENOTDIR ok */
}
*s = '\\';
}
}
(void) Psigsetmask(oldmask);
return 1; /* should have been ENOENT */
}